import axios from 'axios'
import{Message} from 'element-ui'

axios.defaults.timeout=5000;
axios.defaults.baseURL='';

//http request拦截器
axios.interceptors.request.use(
    config=>{
        if(this.$store.state.token){
            config.headers.Authorization ='token ${this.$store.state.token}'
        }
        return config
    },
    err=>{
        return Promise.reject(erro);
    }
)
//http response拦截器
axios.interceptors.response.use(
    response=>{
        return response;
    },
    error=>{
        if(error.response){
            switch(error.response.status){
                case 401:
            }
        }
    }

)